/*=========================================================================
Elite College as Engines of Upward Mobility: Evidence from Colombia's Ser Pilo Paga
Authors: Juliana Londoño-Vélez, Catherine Rodriguez, Fabio Sánchez
and Luis Esteban Álvarez-Arango

Creation date: June 6th, 2025
--------------------------------------------------------------------------
Master.do
=========================================================================*/

*******************************************
*** SET MAIN ENVIRONMENT ***
*******************************************

clear all
set more off, perm
set dp period, perm

	
* Working directory
display c(username) // To know your c(username)
	
* Authors
if 	"`c(username)'"=="larango" | "`c(username)'"=="Esteban" {
	global 	main "C:\Users/`c(username)'/Dropbox\EvaluacionSPP-GeneracionE\Submissions\JPE\Replication"
}

else global 	main ""
		
* Replicator (insert your path)
			
cd "${main}"
	
* Style
set scheme modern, perm
graph set window fontface "Palatino Linotype"

* Max variables
set max_memory ., perm
set maxvar 32767, perm

* Directories
global data 		"C:\Users/`c(username)'/Dropbox\EvaluacionSPP-GeneracionE\Data\Clean" // Contains no public data
global data2 		"C:\Users/`c(username)'/Dropbox\EvaluacionSPP-GeneracionE\Data\Raw" // Contains no public data
global code 		"${main}/Code/Output"	
global raw 			"${main}/Data/Raw" 
global Intermediate	"${main}/Data/Intermediate" 
global outcomes 	"${main}/Production"


/*
* Setting the ado path with required packages
sysdir set PLUS "${main}/Code/ado"
	
*Install packages (You only need to run this part once!)
ssc install egenmore, replace
ssc install ereplace, replace
ssc install winsor2, replace

ssc install gtools
gtools, upgrade
	
cap ado uninstall ftools
net install ftools, from("https://raw.githubusercontent.com/sergiocorreia/ftools/master/src/")

cap ado uninstall reghdfe
net install reghdfe, from("https://raw.githubusercontent.com/sergiocorreia/reghdfe/master/src/")

net install rdrobust, from(https://raw.githubusercontent.com/rdpackages/rdrobust/master/stata) replace

*/	

*******************************************
*** CODE OUTPUT ***
*******************************************

* Inputs for Figures and tables
do "${code}/Output/3_Results_years_PILA.do" 
do "${code}/Output/4_value_added_model.do" 

**# Main
* Figures
do "${code}/Output/Fig_1.do" 
do "${code}/Output/Fig_2_3.do" 
do "${code}/Output/Fig_4_5.do" 
do "${code}/Output/Fig_6.do" 
do "${code}/Output/Fig_7_8.do" 
do "${code}/Output/Fig_9_10_11.do" 

* Tables
do "${code}/Output/Tab_1_2_3_4_A3.do"
do "${code}/Output/Tab_5.do" 
do "${code}/Output/Input_Tab_6.do" 

**# Appendix
* Figures
do "${code}/Output/Fig_A1_A2.do" 
do "${code}/Output/Fig_A_RD.do" 
do "${code}/Output/Fig_A4.do" 
do "${code}/Output/Fig_A5a_A5b_A6b_A7a_A7b.do" 
do "${code}/Output/Fig_A8b_A9b.do" 
do "${code}/Output/Fig_A10.do" 
do "${code}/Output/Fig_A11.do" 
do "${code}/Output/Fig_A12.do" 
do "${code}/Output/Fig_A13.do" 
do "${code}/Output/Fig_A14.do" 
do "${code}/Output/Fig_A15_A16.do" 
do "${code}/Output/Fig_C.do" 
do "${code}/Output/Fig_D.do" 


* Tables
do "${code}/Output/Tab_A1.do" 
do "${code}/Output/Tab_A2_A4.do" 
do "${code}/Output/Tab_A5.do" 
do "${code}/Output/Tab_A6_A7.do" 
do "${code}/Output/Tab_B.do" 



